package ws.jdbc.concurrent.driver.sqlserver.cursor.shared;

import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.concurrent.locks.ReentrantLock;
import ws.jdbc.concurrent.driver.sqlserver.CResultSet;
import ws.jdbc.concurrent.driver.sqlserver.Messages;
import ws.jdbc.concurrent.driver.sqlserver.tds.TDSMessage;

/**
 * Forward-only and updatable result set cursor, with shared cache.
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public class CursorForwardOnlyUpdatable extends CursorSharedCache {

  public CursorForwardOnlyUpdatable(final TDSMessage message, final CResultSet crs, final ReentrantLock lock) throws SQLException {
    super(message, crs, lock);
    initUpdateValue();
  }
  
  // <editor-fold defaultstate="collapsed" desc="Operations not supported by forward-only result set.">
  @Override
  public boolean previous() throws SQLException {
    throw new SQLException(Messages.msg_forward_only);
  }

  @Override
  public boolean absolute(int row) throws SQLException {
    throw new SQLException(Messages.msg_forward_only);
  }

  @Override
  public boolean relative(int rows) throws SQLException {
    throw new SQLException(Messages.msg_forward_only);
  }

  @Override
  public void afterLast() throws SQLException {
    throw new SQLException(Messages.msg_forward_only);
  }

  @Override
  public void beforeFirst() throws SQLException {
    throw new SQLException(Messages.msg_forward_only);
  }

  @Override
  public boolean first() throws SQLException {
    throw new SQLException(Messages.msg_forward_only);
  }

  @Override
  public boolean last() throws SQLException {
    throw new SQLException(Messages.msg_forward_only);
  }

  @Override
  public boolean isAfterLast() throws SQLException {
    throw new SQLFeatureNotSupportedException(Messages.msg_forward_only);
  }

  @Override
  public boolean isBeforeFirst() throws SQLException {
    throw new SQLFeatureNotSupportedException(Messages.msg_forward_only);
  }

  @Override
  public boolean isFirst() throws SQLException {
    throw new SQLFeatureNotSupportedException(Messages.msg_forward_only);
  }

  @Override
  public boolean isLast() throws SQLException {
    throw new SQLFeatureNotSupportedException(Messages.msg_forward_only);
  }
  // </editor-fold>
}
